# import "SavingsCalculatorLampType.h"

@implementation SavingsCalculatorLampType

+(SavingsCalculatorLampType *)instanceFromDictionary:(NSDictionary *)aDictionary {
    SavingsCalculatorLampType *instance = [[SavingsCalculatorLampType alloc] init];
    instance.name = aDictionary[@"name"];
    instance.maxLumen = [aDictionary[@"max_lumen"] integerValue];
    instance.lifeExpectancy = [aDictionary[@"life_expectancy"] integerValue];
    instance.standardPrices = aDictionary[@"standard_prices"];
    instance.powerNeedRelativeClassic = [aDictionary[@"power_need_relative_classic"] floatValue];
    instance.replaceWith = aDictionary[@"replace_with"];
    instance.energyClass = aDictionary[@"energy_class"];
    instance.documentName = aDictionary[@"document"];
    instance.energyRank = [aDictionary[@"energy_rank"] integerValue];
    
    return instance;
}

-(NSString *)lowercaseName {
    if ([self.name hasPrefix:@"LED"]) {
        return self.name;
    } else {
        return [self.name stringByReplacingCharactersInRange:NSMakeRange(0,1)
                                                  withString:[[self.name substringToIndex:1] lowercaseString]];
    }
}

@end
